/*
 * This class is a test class for factory method.
 * 
 * Progress:
 * 		1.new three uname factory to get three phones
 * 		2.named such phones as iPhone,mPhone,sPhone
 * 		3.print phones' brand that make sure this main is finish
 * 
 * public:
 * 	public static void main(String[] args);
 */
package client;

import javax.swing.JFrame;
import javax.swing.JLabel;

import bean.Phone;
import factoryMethod.IPhoneFactory;
import factoryMethod.MiPhoneFactory;
import factoryMethod.SamsungPhoneFactory;

import java.awt.GridLayout;

public class FactoryMethodClient extends JFrame{
	public FactoryMethodClient() {
		getContentPane().setLayout(new GridLayout(6, 0, 0, 0));
		
		//new three uname factory for three named phone
		//phone's name is sPhone,mPhone,iPhone
		Phone sPhone = new SamsungPhoneFactory().getPhone();
		Phone iPhone = new IPhoneFactory().getPhone();
		Phone mPhone = new MiPhoneFactory().getPhone();
				
		//print such three phone's brand to make sure they are unique
		System.out.println("This phone's brand is "+sPhone.getMessage());
		System.out.println("This phone's brand is "+iPhone.getMessage());
		System.out.println("This phone's brand is "+mPhone.getMessage());
				
		
		
		JLabel lbl2 = new JLabel("Phone sPhone = new SamsungPhoneFactory().getPhone();");
		getContentPane().add(lbl2);
		
		JLabel lbl3 = new JLabel("Phone iPhone = new IPhoneFactory().getPhone();");
		getContentPane().add(lbl3);
		
		JLabel lbl4 = new JLabel("Phone mPhone = new MiPhoneFactory().getPhone();");
		getContentPane().add(lbl4);
		
		JLabel lbl5 = new JLabel(iPhone.getMessage());
		getContentPane().add(lbl5);
		
		JLabel lbl6 = new JLabel(mPhone.getMessage());
		getContentPane().add(lbl6);
		
		JLabel lbl7 = new JLabel(sPhone.getMessage());
		getContentPane().add(lbl7);
	}

	/**
	 * 
	 */
	private static final long serialVersionUID = 6355445091399017056L;

	public static void main(String[] args) {
		
		FactoryMethodClient view = new FactoryMethodClient();
		view.setBounds(200, 200, 400, 400);
		view.setVisible(true);
		
	}

}
